#ifndef SL_ANIMATION_HPP
#define SL_ANIMATION_HPP

// std Header

// Eigene Header
#include "SpriteObject.hpp"
#include "FrameInfo.hpp"
#include "../Window/RenderScreen.hpp"

namespace sl
{
	class Animation : public SpriteObject
	{
	public:
		Animation();
		Animation(sf::Texture* img, const sf::Vector2i& size = sf::Vector2i(1, 1));
		Animation(const Animation& anim);

	protected:
		std::vector<FrameInfo> myFrameInfos;
		sf::Vector2i mySize, myOffset;
		unsigned int myTicks, myTick;
		unsigned int myCurFrame;
		bool myIsRunning;

	public:
		virtual Animation* AddFrame(const FrameInfo& info);
		virtual Animation* AddFrame(unsigned int frame, unsigned int delay, const sf::Vector2i& offset = sf::Vector2i(0, 0));
		virtual Animation* SetSize(const sf::Vector2i& size = sf::Vector2i(1, 1));

	protected:
		virtual sf::IntRect GetFrame();
		virtual sf::IntRect GetFrame(unsigned int index);
		virtual sf::IntRect GetFrame(FrameInfo& info);
		virtual Animation* SetOffset(FrameInfo& info);

	public:
		virtual Animation* Start();
		virtual Animation* Stop();
		virtual Animation* Pause();
		virtual Animation* Restart();
		virtual Animation* Update(float time);

	public:
		virtual bool IsRunning();
	};
}

#endif //SL_ANIMATION_HPP